package com.macro.mall.config;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BeanConfigurer {


    @Value("${Hutool.SnowflakeConfig.workerId}")
    private static long workerId;
    @Value("${Hutool.SnowflakeConfig.datacenterId}")
    private static long dataCenterId;

    @Bean
    public Snowflake snowflake() {
       return  IdUtil.getSnowflake(workerId,dataCenterId);
    }
}
